<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>视频上传</title>
    <!-- 引入 layui.css -->
    <link href="//unpkg.com/layui@2.8.18/dist/css/layui.css" rel="stylesheet">
    <!-- 引入 layui.js -->
    <script src="//unpkg.com/layui@2.8.18/dist/layui.js"></script>
</head>

<body>
    <button type="button" class="layui-btn demo-class-accept" lay-options="{accept: 'video'}">
        <i class="layui-icon layui-icon-upload"></i>
        上传视频
    </button>

    <script>
        layui.use(function () {
            var upload = layui.upload
            var layer = layui.layer
            // 渲染
            upload.render({
                elem: '.demo-class-accept', // 绑定多个元素
                url: '/upload_movie', // 此处配置你自己的上传接口即可
                accept: 'file', // 普通文件
                done: function (res) {
                    layer.msg('上传成功');
                    console.log(res);
                    window.open('/', '_self')
                }
            })
        })
    </script>
</body>

</html>